package com.ljy.system.marvel_sys.common.exception;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 〈功能简述〉<br>
 * 〈全局异常处理〉
 *
 * @author LiJunYi
 * @create 2019/7/7
 * @since 1.0.0
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    /**
     * 功能描述: 处理Shiro权限拦截异常
     * @return:
     * @since: 1.0.0
     * @Author:LiJunYi
     * @Date: 2019/7/15 19:49
     */
    @ResponseBody
    @ExceptionHandler(value = AuthorizationException.class)
    public Map<String,Object> defaultErrorHandler(){
        Map<String,Object> map = new HashMap<>();
        map.put("msg", "权限不足");
        return map;
    }
}
